from django.shortcuts import render,loader
from django import http
from  .models import Goods
# Create your views here.
def get_goods(request):
    # return http.HttpResponse('test')
    t = loader.get_template('goods.html')
    goods = Goods.objects.all()
    context = {
        'goods':goods,
    }
    response = t.render(context,request)
    return http.HttpResponse(response)
    # return render(request,'goods.html')


def del_goods(request,gid):
    good = Goods.objects.get(id=gid)
    good.delete()
    return http.HttpResponseRedirect('/')